package user

import (
	"net/http"

	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/logic/user"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/svc"
	"gitee.com/liuxuezhan/ar-platform/admin-api/internal/types"

	"gitee.com/liuxuezhan/ar-platform/base-common/result"

	"github.com/zeromicro/go-zero/rest/httpx"
)

// 会员模块 - 枚举
func EnumHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.EnumRequest
		if err := httpx.Parse(r, &req); err != nil {
			result.HttpErrorResult(r.Context(), w, err)
			return
		}

		l := user.NewEnumLogic(r.Context(), svcCtx)
		resp, err := l.Enum(&req)
		if err != nil {
			result.HttpErrorResult(r.Context(), w, err)
		} else {
			result.HttpSuccessResult(r.Context(), w, resp)
		}
	}
}
